<?php
include_once '../conexion.php';
function getResponsables(){
    $concepto=isset($_REQUEST["ref_parent_id"]) ? $_REQUEST["ref_parent_id"] : '0';
    $sqlstr = "SELECT distinct re.resp_id, re.resp_nombre, re.resp_cuip ".
    "FROM responsable re, rol ro, rol_responsable rr, concepto_movimiento cm, tipo_movimiento tm ".
    "WHERE rr.rolresp_rol_id = ro.rol_id AND rr.rolresp_resp_id = re.resp_id AND ".
    "cm.cmov_tmov_id = tm.tmov_id AND tm.tmov_id = ro.rol_tmov_id AND (cm.cmov_id = {$concepto}) ".
    "ORDER BY re.resp_nombre ASC;";
    $row = '';
    $conn = new Conexion();
    $consulta = $conn->retornar($sqlstr);
    return $consulta;
}
header( "content-type: application/xml; charset=ISO-8859-15" );
$head = '<?xml version="1.0" encoding="ISO-8859-1"?>'. chr(10) .
'<!-- Edited by Federico -->'. chr(10);
$results = getResponsables();
$node = '<ROWS>'. chr(10);
while ($reg = pg_fetch_object($results)) {
    $node .= '<RESPONSABLE>'. chr(10);
    $node .= '<ID>'.$reg->resp_id.'</ID>'. chr(10);
    $node .= '<NOMBRE>'.strToShowValue($reg->resp_nombre).'</NOMBRE>'. chr(10);
    $node .= '<CUIP>'.$reg->resp_cuip.'</CUIP>'. chr(10);
    $node .= '</RESPONSABLE>'. chr(10);
}
$node .= '</ROWS>';
echo $head.$node;
?>
